/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedbean;

import java.util.ArrayList;
import javax.ejb.EJB;

import session.SalesInquirySessionLocal;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author cheeseng
 */
@ManagedBean(name = "saleInqiuryMB")
@RequestScoped
public class SaleInquiryMB {

    @EJB
    private SalesInquirySessionLocal saleInquiryBean;
    private long leadId;
    private String statusMessage;
    private String salutation;
    private String contactPerson;
    private String phone;
    private String email;
    private String comAddress1;
    private String comAddress2;
    private String comPostalCode;
    private String comCountry;
    private Integer gst;
    private String additionalChargeDesc;
    private Double additionalCharge;
    private String additionalChargeType;
    private Double transportCharge;
    private String transportChargeType;
    private Long userId;
    private Long inquiryId;
    private ArrayList saleItem;

    /** Creates a new instance of SaleInquiryMB */
    public SaleInquiryMB() {
    }

    public Double getAdditionalCharge() {
        return additionalCharge;
    }

    public void setAdditionalCharge(Double additionalCharge) {
        this.additionalCharge = additionalCharge;
    }

    public String getAdditionalChargeDesc() {
        return additionalChargeDesc;
    }

    public void setAdditionalChargeDesc(String additionalChargeDesc) {
        this.additionalChargeDesc = additionalChargeDesc;
    }

    public String getAdditionalChargeType() {
        return additionalChargeType;
    }

    public void setAdditionalChargeType(String additionalChargeType) {
        this.additionalChargeType = additionalChargeType;
    }

    public String getComAddress1() {
        return comAddress1;
    }

    public void setComAddress1(String comAddress1) {
        this.comAddress1 = comAddress1;
    }

    public String getComAddress2() {
        return comAddress2;
    }

    public void setComAddress2(String comAddress2) {
        this.comAddress2 = comAddress2;
    }

    public String getComCountry() {
        return comCountry;
    }

    public void setComCountry(String comCountry) {
        this.comCountry = comCountry;
    }

    public String getComPostalCode() {
        return comPostalCode;
    }

    public void setComPostalCode(String comPostalCode) {
        this.comPostalCode = comPostalCode;
    }

    public String getContactPerson() {
        return contactPerson;
    }

    public void setContactPerson(String contactPerson) {
        this.contactPerson = contactPerson;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getGst() {
        return gst;
    }

    public void setGst(Integer gst) {
        this.gst = gst;
    }

    public long getLeadId() {
        return leadId;
    }

    public void setLeadId(long leadId) {
        this.leadId = leadId;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public SalesInquirySessionLocal getSaleInquiryBean() {
        return saleInquiryBean;
    }

    public void setSaleInquiryBean(SalesInquirySessionLocal saleInquiryBean) {
        this.saleInquiryBean = saleInquiryBean;
    }

    public ArrayList getSaleItem() {
        return saleItem;
    }

    public void setSaleItem(ArrayList saleItem) {
        this.saleItem = saleItem;
    }

    public String getSalutation() {
        return salutation;
    }

    public void setSalutation(String salutation) {
        this.salutation = salutation;
    }

    public String getStatusMessage() {
        return statusMessage;
    }

    public void setStatusMessage(String statusMessage) {
        this.statusMessage = statusMessage;
    }

    public Double getTransportCharge() {
        return transportCharge;
    }

    public Long getInquiryId() {
        return inquiryId;
    }

    public void setInquiryId(Long inquiryId) {
        this.inquiryId = inquiryId;
    }

    public void setTransportCharge(Double transportCharge) {
        this.transportCharge = transportCharge;
    }

    public String getTransportChargeType() {
        return transportChargeType;
    }

    public void setTransportChargeType(String transportChargeType) {
        this.transportChargeType = transportChargeType;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public void saveNewSaleInquiry() {
        try {
            inquiryId = saleInquiryBean.createSaleInquiry(userId, contactPerson, comAddress1, comAddress2, comPostalCode, comCountry, phone, salutation, email, gst, additionalChargeDesc, additionalCharge, additionalChargeType, transportCharge, transportChargeType, userId, saleItem);
            statusMessage = "New sale inquiry is saved successfully.";
        } catch (Exception e) {
            statusMessage = e.getMessage();
            inquiryId = -1L;

        }
        //halo
    }
    
  //  public void updateSale
}
